This happens in Latin America all the time. Research what happened in the last election in Venezuela, or if you are lazy watch the election episode of Narcos: Mexico. The strategy is simple. The election must have the appearance of being democratic and legitimate and so that image is well cultivated. However there are built-in mechanisms to prevent an undesirable election result. They happen in the late hours and when it appears the opponent has the advantage. Huge and unlikely margins of new votes are dropped quietly into the totals so as to place the ruling generalissimo or caudillo into the lead as the nation awakes. The state media spins these tales as hometowns coming home to the leading candidate and that these votes are always counted late. The margins increase and by the end of it the winner is clear.
This is a complete joke and the world laughs at the USA. So great of a nation it has to borrow an old trick perfected in modern times by Hugo Chavez.